[FLEX] Images won't dynamically refresh

Posted by Bridget on Stack Overflow See other posts from Stack Overflow or by Bridget
Published on 2010-04-23T18:05:37Z Indexed on 2010/04/25 16:13 UTC
Read the original article Hit count: 194

Filed under:
|
|
|

I am writing a Flex application to receive xml from an httpservice. That works because I can populate a datagrid with the information. The xml sends image pathnames. A combobox sends a new HttpService call onChange. This repopulates the datagrid and puts new images in the folder that flex is accessing.

I want to dynamically change the image without changing the pathname of the image.

<mx:Canvas id="borderCanvas"><mx:Canvas id="dropCanvas">
  <mx:Tile id="adTile"><mx:Image></mx:Image>
  </mx:Tile></mx:Canvas></mx:Canvas>

This is my component. I assign my Image sources using this code:

var i:Number = 0;
      while ( i <= dg_conads.rowCount){
        var img:Image = new Image();
        img.source = null;
        img.source = imageSource+i+".jpg";
        adTile.addChild(img);
        i++; }

My biggest problem is that the images are not refreshing. I get the same image even though I've prevented caching from the HTML wrapper and the ASP.Net website. The image automatically loads in the folder and refreshes in the folder but I can't get the image to refresh in the application. I've tried removeAllChildren(); delete(adTile.getChildAt(0)); and neither worked.

© Stack Overflow or respective owner

Related posts about actionscript-3

Related posts about flex